package org.afs.gescol.core.model.params;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.afs.gescol.core.model.references.YearStatus;
import org.hibernate.annotations.ForeignKey;
import org.scub.foundation.framework.core.model.BaseModel;

/**
 * Parameter model for school year split.
 * @autor Kobla GBENYO (kobla.gbenyo@gmail.com)
 */
@Entity
@Table(name = "param_year")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "year_id", nullable = false)),
    @AttributeOverride(name = "version", column = @Column(name = "year_version", nullable = false, unique = false)),
})
public class Year extends BaseModel {

    /** Serial Version UID. */
    private static final long serialVersionUID = 5393548435737948029L;

    @Column(name = "year_begin")
    private int beginYear;

    @Column(name = "year_end")
    private int endYear;

    @ManyToOne
    @JoinColumn(name = "year_status_id")
    @ForeignKey(name = "fk_param_year_ref_year_status_id")
    private YearStatus status;

    @Override
    public boolean equals(Object other) {
        return equalsUtil(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    /**
     * Get the value of beginYear.
     * @return the beginYear
     */
    public int getBeginYear() {
        return beginYear;
    }

    /**
     * Set the value of beginYear.
     * @param beginYear the beginYear to set
     */
    public void setBeginYear(int beginYear) {
        this.beginYear = beginYear;
    }

    /**
     * Get the value of endYear.
     * @return the endYear
     */
    public int getEndYear() {
        return endYear;
    }

    /**
     * Set the value of endYear.
     * @param endYear the endYear to set
     */
    public void setEndYear(int endYear) {
        this.endYear = endYear;
    }

    /**
     * Get the value of status.
     * @return the status
     */
    public YearStatus getStatus() {
        return status;
    }

    /**
     * Set the value of status.
     * @param status the status to set
     */
    public void setStatus(YearStatus status) {
        this.status = status;
    }

}
